Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <button onclick="setMedGroup()" type="button">Set media group for videos</button> <button onclick="getMedGroup()" type="button">Get media group for videos</button><br> <video id="myVideo1" width="320" height="176" controls> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video> <video id="myVideo2" width="320" height="176" controls> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video> <script> var vid1 = document.getElementById("myVideo1"); var vid2 = document.getElementById("myVideo2"); function setMedGroup() { vid1.mediaGroup="test"; vid2.mediaGroup="test"; } function getMedGroup() { alert("Video 1 media group: " + vid1.mediaGroup + ". Video 2 media group: " + vid2.mediaGroup); } </script> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> </body> <!-- Mirrored from www.w3schools.com/tags/tryit.asp?filename=tryhtml5_av_prop_mediagroup by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:09:54 GMT --> </html>
Result:
Try it Yourself - © w3schools.com